Framebuffer attachment state. More...
#include <kanzi/core.ui/graphics2d/framebuffer.hpp>
Classes | |
| struct | AttachmentData |
| Optional attachment information. More... | |
| class | AttachmentPoint |
| Attachment point. More... | |
| class | ResolveTarget |
| Resolve target. More... | |
Public Member Functions | |
| void | clearAttachements () |
| Clears all attachments and resolve targets. | |
| const AttachmentPoint * | getColorAttachment (size_t index) const |
| Gets the attachment at given index. | |
| size_t | getColorAttachmentLimit () const |
| Gets the number of color attachments. | |
| RenderbufferSharedPtr | getColorRenderbuffer (size_t index) const |
| Gets the color renderbuffer at given index, if one exists. | |
| TextureSharedPtr | getColorResolveTarget (size_t index) const |
| Gets the resolve target at given index. | |
| TextureSharedPtr | getColorTexture (size_t index) const |
| Gets the color texture at given index, if one exists. | |
| AttachmentPoint * | getDepthStencilAttachment () const |
| Gets the depth/stencil attachment. | |
| RenderbufferSharedPtr | getDepthStencilRenderbuffer () const |
| Gets the depth/stencil renderbuffer if one exists. | |
| TextureSharedPtr | getDepthStencilResolveTarget () const |
| Gets the depth or stencil resolve target, if one exists. | |
| TextureSharedPtr | getDepthStencilTexture () const |
| Gets the attached depth/stencil texture, if one exists. | |
| size_t | getGPUMemoryUsage () const |
| Gets the amount of GPU memory consumed by the framebuffer. | |
| gfx::FrameBufferHandleGuard | getHandle () const |
| Gets the graphics framebuffer handle. | |
| NativeFramebufferHandle | getNativeHandle () const |
| Gets the native framebuffer handle. | |
| RenderPassArchetypeSharedPtr | getRenderPassArchetype () const |
| Gets the graphics framebuffer handle. | |
| bool | hasAttachedDepthTarget () const |
| Indicates whether or not the framebuffer has an attachment with depth. | |
| void | invalidate () |
| Invalidates the current framebuffer state. | |
| bool | removeColorAttachment (size_t index) |
| Clears the color attachment at index. | |
| bool | removeDepthStencilAttachment () |
| Clears the depth/stencil attachment. | |
| bool | resolveColorMSAA (Renderer &renderer, size_t index) |
| Resolves first color renderbuffer MSAA into a texture attached to another framebuffer. | |
| bool | resolveDepthMSAA (Renderer &renderer) |
| Resolves the depth renderbuffer MSAA into a texture attached to another framebuffer. | |
| bool | resolveMSAA (Renderer &renderer) |
| Resolves MSAA into a texture attached to another framebuffer. | |
| bool | setColorAttachment (size_t index, const Renderbuffer::CreateInfo &createInfo, string_view name) |
| Sets the color attachment at index. | |
| bool | setColorAttachment (size_t index, const RenderbufferSharedPtr &renderbuffer) |
| Sets the color attachment at index. | |
| bool | setColorAttachment (size_t index, const TextureSharedPtr &texture) |
| Sets the color attachment at index. | |
| bool | setColorAttachment (size_t index, const TextureSharedPtr &texture, size_t faceIndex) |
| Sets the color attachment at index. | |
| bool | setColorAttachment (size_t index, const TextureSharedPtr &texture, size_t faceIndex, size_t mipmapLevel) |
| Sets the color attachment at index. | |
| bool | setColorResolveTarget (size_t index, const TextureSharedPtr &texture) |
| Sets the color resolve target at index. | |
| bool | setDepthStencilAttachment (const Renderbuffer::CreateInfo &createInfo, string_view name) |
| Sets the depth/stencil attachment. | |
| bool | setDepthStencilAttachment (const RenderbufferSharedPtr &renderbuffer) |
| Sets the depth/stencil attachment. | |
| bool | setDepthStencilAttachment (const TextureSharedPtr &texture) |
| Sets the depth/stencil attachment. | |
| bool | setDepthStencilAttachment (const TextureSharedPtr &texture, size_t faceIndex) |
| Sets the depth/stencil attachment. | |
| bool | setDepthStencilAttachment (const TextureSharedPtr &texture, size_t faceIndex, size_t mipmapLevel) |
| Sets the depth/stencil attachment. | |
| bool | setDepthStencilResolveTarget (const TextureSharedPtr &texture) |
| Sets the color resolve target at index. | |
| void | setHandle (gfx::FrameBufferHandleGuard handle) |
| Updates the framebuffer to use an explicit Kanzi graphics frame buffer handle. | |
| void | setRenderPassArchetype (RenderPassArchetypeSharedPtr archetype) |
| Sets the render pass archetype for the frame buffer. | |
| void | swapAttachment (Texture &oldTexture, Texture &newTexture) |
| Replaces the reference in an AttachmentPoint with the newTexture, if the reference is to the oldTexture. | |
| bool | update (Renderer &renderer) |
| Updates the framebuffer state. | |
Static Public Member Functions | |
| static unique_ptr< Framebuffer > | create (string_view name) |
| Creates a framebuffer. | |
Protected Member Functions | |
| void | colorLimitDecrementCheck () |
| If the last color elements were cleared, decrement the color limit. | |
| void | ensureAttachmentData () |
| Ensure that the AttachmentData is allocated. | |
| Framebuffer (string_view name) | |
| Default constructor. | |
| bool | markColorAttachmentDirty (size_t index, bool dirty) |
| Potentially mark a color attachment (and the framebuffer dirty). | |
Protected Attributes | |
| unique_ptr< AttachmentData > | m_attachmentData |
| Optional attachment information. | |
| bool | m_dirty |
| Flag for indicating the attachments have changed. | |
| gfx::FrameBufferHandleGuard | m_handle |
| Handle for the framebuffer object. | |
| string | m_name |
| Name of the framebuffer. | |
| RenderPassArchetypeSharedPtr | m_renderPassArchetype |
| RenderPass Archetype. | |
Framebuffer attachment state.
Handles the attachment state for a framebuffer that combines multiple textures and renderbuffers into one render context.
Framebuffer is not a GPUResource, so for calculating total GPU memory and invalidating the state, it must be owned by another GPU resource.
Framebuffer class is intended for internal use by other Kanzi subsystems controlling rendering. It can also be used manually:
|
explicitprotected |
Default constructor.
| name | Name of the framebuffer. |
|
inlinestatic |
Creates a framebuffer.
| name | Framebuffer name. |
| void kanzi::Framebuffer::invalidate | ( | ) |
Invalidates the current framebuffer state.
Updates the framebuffer state.
Needs to be done if the attachments have changed.
| renderer | Renderer to use for the update. |
| bool kanzi::Framebuffer::setColorAttachment | ( | size_t | index, |
| const Renderbuffer::CreateInfo & | createInfo, | ||
| string_view | name ) |
Sets the color attachment at index.
If the index is out of range, nothing is assigned.
| index | Index to set to. |
| createInfo | Renderbuffer create info |
| name | Name of the renderbuffer. |
| bool kanzi::Framebuffer::setColorAttachment | ( | size_t | index, |
| const RenderbufferSharedPtr & | renderbuffer ) |
Sets the color attachment at index.
If the index is out of range, nothing is assigned.
| index | Index to set to. |
| renderbuffer | Renderbuffer to set |
| bool kanzi::Framebuffer::setColorAttachment | ( | size_t | index, |
| const TextureSharedPtr & | texture, | ||
| size_t | faceIndex, | ||
| size_t | mipmapLevel ) |
Sets the color attachment at index.
If the index is out of range, nothing is assigned.
| index | Index to set to. |
| texture | Texture to set. |
| faceIndex | Attachment face index. |
| mipmapLevel | Attachment mipmap level. |
|
inline |
Sets the color attachment at index.
Mipmap level is set to 0.
| index | Index to set to. |
| faceIndex | Attachment face index. |
| texture | Texture to set. |
|
inline |
Sets the color attachment at index.
Face index is set to 0. Mipmap level is set to 0.
| index | Index to set to. |
| texture | Texture to set. |
| bool kanzi::Framebuffer::removeColorAttachment | ( | size_t | index | ) |
Clears the color attachment at index.
Updates the number of active color attachments.
| index | Index to clear. |
| bool kanzi::Framebuffer::setColorResolveTarget | ( | size_t | index, |
| const TextureSharedPtr & | texture ) |
Sets the color resolve target at index.
| index | Index to set to. |
| texture | Texture to set. |
| bool kanzi::Framebuffer::setDepthStencilAttachment | ( | const Renderbuffer::CreateInfo & | createInfo, |
| string_view | name ) |
Sets the depth/stencil attachment.
| createInfo | Renderbuffer create info |
| name | Name of the renderbuffer. |
| bool kanzi::Framebuffer::setDepthStencilAttachment | ( | const RenderbufferSharedPtr & | renderbuffer | ) |
Sets the depth/stencil attachment.
| renderbuffer | Renderbuffer to set |
| bool kanzi::Framebuffer::setDepthStencilAttachment | ( | const TextureSharedPtr & | texture, |
| size_t | faceIndex, | ||
| size_t | mipmapLevel ) |
Sets the depth/stencil attachment.
| texture | Texture to set. |
| faceIndex | Attachment face index. |
| mipmapLevel | Attachment mipmap level. |
|
inline |
Sets the depth/stencil attachment.
Mipmap level is set to 0.
| texture | Texture to set. |
| faceIndex | Attachment face index. |
|
inline |
Sets the depth/stencil attachment.
Face index is set to 0. Mipmap level is set to 0.
| texture | Texture to set. |
| bool kanzi::Framebuffer::removeDepthStencilAttachment | ( | ) |
Clears the depth/stencil attachment.
| bool kanzi::Framebuffer::setDepthStencilResolveTarget | ( | const TextureSharedPtr & | texture | ) |
Sets the color resolve target at index.
| texture | Texture to set. |
| void kanzi::Framebuffer::clearAttachements | ( | ) |
Clears all attachments and resolve targets.
After calling this function, the framebuffer is ready for reuse
Resolves first color renderbuffer MSAA into a texture attached to another framebuffer.
| renderer | Renderer to use for resolve. |
| index | Index of the color attachment to resolve. |
Resolves the depth renderbuffer MSAA into a texture attached to another framebuffer.
| renderer | Renderer to use for resolve. |
Resolves MSAA into a texture attached to another framebuffer.
What to resolve is determined from the target framebuffer.
| renderer | Renderer to use for resolve. |
| size_t kanzi::Framebuffer::getGPUMemoryUsage | ( | ) | const |
Gets the amount of GPU memory consumed by the framebuffer.
Only renderbuffers created by the framebuffer are calculated. Renderbuffers and textures assigned from outside own their own memory.
|
inline |
| void kanzi::Framebuffer::setHandle | ( | gfx::FrameBufferHandleGuard | handle | ) |
Updates the framebuffer to use an explicit Kanzi graphics frame buffer handle.
| handle | The Kanzi graphics framebuffer handle. |
|
inline |
Gets the native framebuffer handle.
This function is deprecated.
|
inline |
Sets the render pass archetype for the frame buffer.
| archetype | The render pass archetype |
|
inline |
|
inline |
Gets the attachment at given index.
| index | Index to access. |
|
inline |
Gets the number of color attachments.
This number does not imply actual count of color attachments or mean there are no gaps in the array. The number implies the current maximum number of color attachments, supposing pointers have not expired.
|
inline |
Gets the color renderbuffer at given index, if one exists.
| index | Index to access. |
|
inline |
Gets the color texture at given index, if one exists.
| index | Index to access. |
|
inline |
Gets the resolve target at given index.
| index | Index to access. |
|
inline |
Gets the depth/stencil attachment.
The attachment may not be valid.
|
inline |
|
inline |
|
inline |
Gets the depth or stencil resolve target, if one exists.
|
inline |
Indicates whether or not the framebuffer has an attachment with depth.
Replaces the reference in an AttachmentPoint with the newTexture, if the reference is to the oldTexture.
This is called when the Texture itself has been swapped, and therefore references internal to Framebuffer should be updated to point to the same texture.
| oldTexture | The old texture to be updated. |
| newTexture | The new texture to use. |
|
inlineprotected |
Ensure that the AttachmentData is allocated.
Potentially mark a color attachment (and the framebuffer dirty).
Called when a color attachment is set.
| index | Color attachment modified. |
| dirty | The dirty flag. |
|
inlineprotected |
If the last color elements were cleared, decrement the color limit.
|
protected |
Name of the framebuffer.
|
protected |
Handle for the framebuffer object.
|
protected |
RenderPass Archetype.
|
protected |
|
mutableprotected |
Optional attachment information.